<?php

namespace Modules\Shop\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Modules\Shop\Service\DiscoverService;


class DiscoverController extends BaseController
{


	/**
	 *	朋友圈列表
	 *	hinq 2019 10 28
	 *
	 **/
	public function index(){
		$arr_search = (array) Request::all();
		$arr_list = DiscoverService::get_discover_list( (array) $arr_search );
		return view('shop::discover.index',$arr_list['data']);
	}




	/** 
	 *  添加朋友圈
	 *	hinq 2019 10 28
	 *
	 **/
	public function create(){
		return view('shop::discover.create');
	}


	/**
	 *	添加朋友圈数据
	 *	hinq 2019 10 28
	 *
	 **/
	public function store() {
		$arr_input = (array)Request::input();
		return DiscoverService::store( (array) $arr_input );
	}

	/**
	 *	删除朋友圈
	 *	hinq 2019 10 28
	 *
	 **/
	public function del(){
		$nId = (int)Request::get('id');
		return DiscoverService::del( (int) $nId );
	}


	/**
	 *	朋友圈详细信息
	 *	hinq 2019 10 29
	 *
	 **/
	public function detail(){
		$arr_search = Request::all();
		//获取数据
		$arr_list = DiscoverService::detail( (array) $arr_search );
		echo_error($arr_list);
		return view('shop::discover.detail',$arr_list['data']);
	}

	/**
	 *  编辑朋友圈信息
     *  hinq 2019 12 05
     *
     **/
    public function edit( Request $request ){
        $nId = $request::get('id');
        $arr_list = DiscoverService::get_one( (int) $nId );
        return view('shop::discover.edit',['info'=>$arr_list['data']]);
    }


    /**
     *  编辑朋友圈信息
     *  hinq 2019 12 05
     *
     **/
    public function update( Request $request ){

        $arr_input = (array) $request::all();
        return DiscoverService::update( (array) $arr_input );
    }



}